/*
** Copyright (C) 2009 Zhang Cong <ftofficer@ftofficer.com>
**  
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**  
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**  
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**  
*/

/**
   @file liboi_err.h Define liboi error codes.
*/

#ifndef LIBOI_ERR_H_
#define LIBOI_ERR_H_

typedef int liboi_err_t;

const char* liboi_strerror(liboi_err_t errcode);

#include <errno.h>

#ifndef BEGIN_ERROR_MAP
#define BEGIN_ERROR_MAP()  enum _liboi_err_values {
#endif // BEGIN_ERROR_MAP

#ifndef DEF_ERROR
#define DEF_ERROR(n, v, s) n= (v),
#endif // DEF_ERROR

#ifndef END_ERROR_MAP
#define END_ERROR_MAP() };
#endif // END_ERROR_MAP

BEGIN_ERROR_MAP()

DEF_ERROR(LIBOI_OK, 0, "No error")
DEF_ERROR(LIBOI_E_NOTIMPL, -1, "Not implemented")

DEF_ERROR(LIBOI_E_NO_DEVICE, -10, "No device")
DEF_ERROR(LIBOI_E_SSHCONN, -11, "Establish SSH conn failed")
DEF_ERROR(LIBOI_E_CONNECTED, -12, "Already connected")
DEF_ERROR(LIBOI_E_NOT_CONNECTED, -13, "Not connected")
DEF_ERROR(LIBOI_E_NOT_OPENINKPOT, -14, "Not OpenInkpot device")

END_ERROR_MAP()

#endif // LIBOI_ERR_H_

